<template>
    <div class="container" style="max-width:100%;">
        <div class="app col-md-12" style="background: #fff; padding:10px ; border-radius: 5px; margin-top:30px">
            <div>
                <!-- 头部查询功能 -->
                <div style="display: flex; justify-content: space-between;">
                    <div style="display: flex;">
                        <el-input :placeholder="searchTitle" v-model="devname"
                            style="width: 20%;margin-right:20px;min-width:160px;"></el-input>
                        <template v-if="this.url !== '/feedback/list'">
                            <div class="block" style="margin-right:20px" v-if="this.popTit.title !== '创建角色'">
                                <span @click="lastMon">
                                    <el-date-picker @focus="lastMon" v-model="timer" ref="timeset" :clearable="false"
                                        popper-class="noClear" type="datetimerange" start-placeholder="开始时间"
                                        end-placeholder="结束时间">
                                        <!-- value-format="yyyy-MM-dd HH:mm:ss" -->
                                    </el-date-picker>
                                </span>
                            </div>
                        </template>
                        <template>
                            <el-select v-if="funcDisplay == '01'" v-model="typeValue" @change="typeChange" placeholder="全部"
                                style="margin-right: 20px;">
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </template>
                        <el-button @click="queryDev" style="margin-right:20px">查询</el-button>
                        <el-button @click="emptyDev" style="margin-left:0px">重置</el-button>
                    </div>
                    <div></div>
                    <el-button type="primary" plain style="float: right; padding:3px;height:32px" @click="establish"
                        v-show="popTit.title">{{ popTit.title }}</el-button>
                </div>
                <!-- 批量删除按钮 -->
                <div style="margin-top: 5px;"
                    v-if="this.$route.name == 'Workorder' || this.$route.name == 'handle' || this.$route.name == 'feedback'">
                    <el-button @click="deleteAll" style="margin-left: 0%;padding: 8px 10px;">批量删除</el-button>
                </div>
                <!-- 列展示按钮 -->
                <el-popover trigger="click"
                    v-if="this.$route.name == 'handle' || this.$route.name == 'Reportdata' || this.$route.name == 'Workorder'"
                    class="popover" @show="showPopover">
                    <div
                        style="display: flex; justify-content: space-between;align-items: center; border-bottom:1px solid #409EFF; padding-bottom:5px;margin-bottom:5px">
                        <el-checkbox v-model="checkAll" @change="checkAllChangeFn">列展示</el-checkbox>
                    </div>
                    <el-checkbox-group v-model="checkColumns" @change="changeColumns">
                        <el-checkbox v-for="item in columns" :label="item.label"></el-checkbox>
                    </el-checkbox-group>
                    <i class="el-icon-menu" slot="reference"></i>
                </el-popover>
                <el-table ref="table" height='542' id="table" :data="tableData" :index-key="index => index"
                    @selection-change="handleSelectionChange" border style=" margin: 0; margin-top: 10px;">
                    <el-table-column
                        v-if="this.$route.name == 'feedback' || this.$route.name == 'handle' || this.$route.name == 'Workorder'"
                        type="selection" width="55">
                    </el-table-column>
                    <template v-for="item in columns">
                        <template v-if="item.prop == 'type'">
                            <el-table-column v-if="showColumn(item.prop)" :prop="item.prop" :label="item.label"
                                :width="formwidth">
                                <template slot-scope="scope">
                                    {{ scope.row.type == '01' ? '浓度异常' : '温度异常' }}
                                </template>
                            </el-table-column>
                        </template>
                        <template v-else-if="item.prop == 'type1'">
                            <el-table-column v-if="showColumn(item.prop)" :prop="item.prop" :label="item.label"
                                :width="formwidth">
                                <template slot-scope="scope">
                                    {{ scope.row.type == '01' ? '整机故障' : '传感器故障' }}
                                </template>
                            </el-table-column>
                        </template>
                        <template v-else-if="item.prop == 'state'">
                            <el-table-column v-if="showColumn(item.prop)" :prop="item.prop" :label="item.label"
                                :width="formwidth">
                                <template slot-scope="scope">
                                    {{ scope.row.state | Dispatchstatus }}
                                </template>
                            </el-table-column>
                        </template>
                        <template v-else-if="item.prop == 'alarmType'">
                            <el-table-column v-if="showColumn(item.prop)" :prop="item.prop" :label="item.label"
                                :width="formwidth">
                                <template slot-scope="scope">
                                    {{ scope.row.alarmType | WorkOrderType }}
                                </template>
                            </el-table-column>
                        </template>
                        <template v-else-if="item.prop == 'pictureUrl'">
                            <!-- <el-table-column v-if="showColumn(item.prop)" :prop="item.prop" :label="item.label"
                                :width="formwidth">
                            </el-table-column> -->
                            <!-- 图片展示部分 -->
                            <el-table-column align="center" :prop="item.prop" :label="item.label" :width="formwidth">
                                <template slot-scope="scope">
                                    <!-- v-for="(item, index) in scope.row.pictureUrl" :key="index"多图展示 -->
                                    <el-image :src="scope.row.pictureUrl" :preview-src-list="[scope.row.pictureUrl]">
                                        <div slot="error" class="image-slot"></div>
                                    </el-image>
                                </template>
                            </el-table-column>
                        </template>
                        <template v-else>
                            <el-table-column v-if="showColumn(item.prop)" :prop="item.prop" :label="item.label"
                                :width="formwidth">
                            </el-table-column>
                        </template>
                    </template>
                    <el-table-column v-if="this.$route.name == 'Workorder'" fixed="right" label="操作" width="180">
                        <template slot-scope="scope">
                            <el-button @click="dispatch(scope.row)" type="primary" size="small"
                                :disabled="scope.row.state == '3' ? true : false || scope.row.state == '2' ? true : false || scope.row.state == '1' ? true : false">派单</el-button>
                            <el-button @click="modify(scope.row)" type="warning" size="small"
                                :disabled="scope.row.state == '3' ? true : false || scope.row.state == '2' ? true : false">修改</el-button>
                            <el-button @click="statement(scope.row)" type="success" size="small"
                                :disabled="scope.row.state == '3' ? true : false">结单</el-button>
                            <el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="danger"
                                size="small">删除</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column v-if="this.$route.name == 'role'" fixed="right" label="操作" width="90">
                        <template slot-scope="scope">
                            <el-button @click="modify(scope.row)" type="text" size="small">修改</el-button>
                            <el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="text"
                                size="small">删除</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column v-if="this.$route.name == 'Form'" fixed="right" label="操作" width="150">
                        <template slot-scope="scope">
                            <el-button @click="jurisdiction(scope.row)" type="primary" size="small">权限</el-button>
                            <el-button @click="site(scope.row)" type="warning" size="small">站点</el-button>
                            <el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="danger"
                                size="small">删除</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column v-if="this.$route.name == 'handle'" fixed="right" label="操作" width="100">
                        <template slot-scope="scope">
                            <el-button @click="operation(scope.row)" type="primary" size="small"
                                :disabled="scope.row.state !== '1' ? true : false">操作</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                    :current-page="currentPage" :page-sizes="[10, 15, 20]" :page-size="10"
                    layout="total, sizes, prev, pager, next, jumper" :total="tota">
                </el-pagination>
                <!-- 权限对话框 -->
                <purviewPop v-show="purvshow == true" :purvshow="purvshow" :purviewId="purviewId" :popTitle="popTitle"
                    @purview-event="purview" :params="params" :data="data">
                </purviewPop>
                <!-- 站点对话框 -->
                <sitePop :siteval="siteval" :siteshow="siteshow" :popTitle="popTitle" @site-event="siteEvent"
                    :params="params" :data="data">
                </sitePop>
                <!-- 对话框 -->
                <workPop :popTitle="popTitle" :workOrder="workOrder" @deleteData="deleData" @custom-event="devHidden"
                    :params="params" :addTitle="addTitle">
                </workPop>
                <!-- 批量删除对话框 -->
                <Delete :deletshow="deletshow" :deleteurl="deleteurl" @delete-event="deleteDialog" :selectList="selectList">
                </Delete>
            </div>
        </div>
    </div>
</template>
   
<script>
import { Message } from 'element-ui'
import { getWork } from '@/api/table'
import workPop from '@/components/Form/Dialog/workPop.vue'
import purviewPop from '@/components/Form/Dialog/purviewPop.vue'
import sitePop from '@/components/Form/Dialog/sitePop.vue'
//批量删除对话框
import Delete from "@/components/Form/delete.vue";

export default {
    data() {
        return {
            //批量删除数组
            selectList: [],
            //批量删除路径
            deleteurl: '',
            //批量删除对话框是否显示
            deletshow: false,
            // 选择类型值
            typeValue: '',

            tableAll: [], //所有的数据
            tablePage: [], //某一页的数据

            siteval: [],
            // 站点显示
            siteshow: false,
            // 对话框是否显示
            purvshow: false,
            workOrder: false,
            timer: [new Date(), new Date()],
            devname: '',
            searchContent: '',
            tableData: [],


            checkColumns: [],
            checkAll: false,
            // 总条数，根据接口获取数据长度(注意：这里不能为空)
            tota: 0,
            // 默认每页显示的条数（可修改）
            PageSize: 10,
            // 默认显示第一条
            currentPage: 1,
            params:
            {
                "alarmType": '',//工单类型
                "workOrderRemark": '',//工单信息
                "equipmentNo": '',//设备编号
            },

            addTitle: {
                "alarmType": '工单类型',//工单类型
                "workOrderRemark": '工单信息',//工单信息
                "equipmentNo": '设备编号'//设备编号
            },

            popTitle: {
                'title': '创建工单',
            },
            data: [],

            thisrows: [],
            thisindex: '',
            // 获取选中权限
            purviewId: [],
            purviewData: []
        }

    },
    components: {
        workPop, purviewPop, sitePop, Delete
    },
    props: {
        searchTitle: {
            type: String,
            required: true
        },
        url: {
            type: String,
            required: true
        },
        columns: {
            type: Array,
            required: true
        },
        formwidth: {
            type: String,
            required: true

        },
        popTit: {
            type: Object,
            required: true
        },
        funcDisplay: {
            type: String,
            required: true
        },
        options: {
            type: Array,
            required: true
        }
    },
    filters: {
        Dispatchstatus(val) {
            if (val == '0') {
                return '未派单'
            } else if (val == '1') {
                return '处理中'
            } else if (val == '2') {
                return '待结单'
            } else {
                return '已完成'
            }
        },
        WorkOrderType(val) {
            // 1数值报警2故障报警3离线报警4其他
            if (val == '1') {
                return '数值报警'
            } else if (val == '2') {
                return '故障报警'
            } else if (val == '3') {
                return '离线报警'
            } else {
                return '其他'
            }
        }
    },
    methods: {
        //设置默认月份为上一个月到本月
        lastMon() {
            const date = new Date()
            let y = date.getFullYear().toString();
            let m = date.getMonth().toString();
            let d = date.getDate().toString();
            this.timer = [
                this.formatDate(new Date(y, m - 1, d).setHours(0, 0, 0)),
                this.formatDate(new Date(y, m, d).setHours(23, 59, 59))
            ]
        },
        //批量删除对话框返回对话框是否显示
        deleteDialog(data) {
            this.deletshow = data
            let data1 = {}
            data1 = { startTime: this.timer[0], endTime: this.timer[1] }
            getWork(this.url, 'get', data1).then(res => {
                this.tableData = res.msg
                this.tota = res.total
            })
        },
        //批量删除选中
        deleteAll() {
            if (this.selectList.length == 0) {
                Message({
                    message: '选择不能为空',
                    type: 'waring',
                    duration: 3 * 1000
                })
            } else {
                if (this.$route.name == 'feedback') {
                    this.deleteurl = '/feedback/batchRemove'
                }
                if (this.$route.name == 'handle') {
                    this.deleteurl = '/handle/batchRemove'
                }
                if (this.$route.name == 'Workorder') {
                    this.deleteurl = '/workOrder/batchRemove'
                }
                this.deletshow = true
            }
        },
        // 改变状态
        typeChange() {
            // console.log(this.typeValue);
        },
        // 点击表格的选择框
        handleSelectionChange(val) {
            // console.log(val);
            let setlist = []
            for (let index = 0; index < val.length; index++) {
                if (this.$route.name == 'handle') {
                    setlist.push(val[index].id)
                }
                if (this.$route.name == 'Workorder') {
                    setlist.push(val[index].workOrderId)
                }
                if (this.$route.name == 'feedback') {
                    setlist.push(val[index].id)
                }
                setlist.filter(item => { return item })
            }
            // 批量删除数组
            this.selectList = setlist
        },
        // 站点权限
        site(data) {
            // 控制对话框显示隐藏
            this.siteshow = true;
            // 设置对话框表头
            this.popTitle = {
                'title': '站点设置'
            }
            this.params = data
            const url = '/equipment/findStationTree/' + data.roleId;
            //获取未选中站点pid
            let siteData = [];
            // 获取选中站点pid
            let sitvalue = [];
            getWork(url, 'get').then(res => {
                let resData = res.msg[0].children[0].children
                resData.forEach((item, index) => {
                    if (item.flag == false) {
                        siteData.push({
                            label: item.text,
                            pid: 0,
                            id: item.id
                        });
                    } else {
                        sitvalue.push({
                            label: item.text,
                            pid: 0,
                            id: item.id
                        })
                    }
                });
            });
            this.siteval = [];
            this.siteval = sitvalue;
            this.data = [];
            this.data = siteData
        },
        // 权限
        jurisdiction(data) {
            // console.log(data);
            // 设置对话框表头
            this.popTitle = {
                'title': '权限设置'
            }
            this.params = data
            // 获取权限
            this.data = [];
            this.purviewId = [];
            this.purviewData = [];
            let url = '/module/tree/' + data.roleId
            getWork(url, 'get').then(res => {
                this.data.push(res.msg)
                console.log(this.data);
                this.purviewData.push(res.msg)
                this.forData(this.purviewData)
            });

            // 控制对话框显示隐藏
            this.purvshow = true;
        },
        forData(data) {
            if (data.length !== 0) {
                for (let index = 0; index < data.length; index++) {
                    if (data[index].state.selected == true && data[index].allCheck !== false) {
                        this.purviewId.push(data[index].id)
                        this.purviewId = this.purviewId.filter((item, index, array) => {
                            return array.indexOf(item) === index;
                        });
                    }
                    if (data[index].hasChildren == true) {
                        this.purviewData = data[index].children
                        this.forData(this.purviewData)
                    }
                }
            }
        },
        // 结单
        statement(data) {
            this.workOrder = true;
            this.popTitle = {
                'title': '结单'
            }
            this.params = {
                'workOrderId': data.workOrderId,//工单编号
            }
        },
        // 操作
        operation(data) {
            // 对话框显示
            this.workOrder = true;
            this.popTitle = {
                'title': '处理结果'
            }
            this.params = {
                'id': data.workOrderId,//工单编号
                'state': '',//处理状态
                'deatail': '',//备注
                // 'uploadFile':'',
            }
        },
        // 派单
        dispatch(data) {
            // console.log(data);

            this.workOrder = true;
            this.popTitle = {
                'title': '指派工单'
            }
            this.params = {
                'workOrderId': data.workOrderId,//工单编号
                'userId': ''
            }
        },
        // 删除工单
        deleteRow(index, rows) {
            this.thisindex = index;
            this.thisrows = rows;
            this.workOrder = true;
            if (this.$route.name == 'Form') {
                this.popTitle = {
                    'title': '删除角色'
                }
                this.params = {
                    'roleId': rows[index].roleId,//工单编号
                }
            } else {
                this.popTitle = {
                    'title': '删除工单'
                }
                this.params = {
                    'workOrderId': rows[index].workOrderId,//工单编号
                }
            }
            // rows.splice(index, 1);
        },
        deleData(code) {
            if (code == 0) {
                this.thisrows.splice(this.thisindex, 1)
            }
        },
        // 创建工单
        establish() {
            this.workOrder = true;
            if (this.popTit.title == '创建工单') {
                this.params = {
                    "alarmType": '',//工单类型
                    "workOrderRemark": '',//工单信息
                    "equipmentNo": '',//设备编号
                };
                this.addTitle = {
                    "alarmType": '工单类型',//工单类型
                    "workOrderRemark": '工单信息',//工单信息
                    "equipmentNo": '设备编号',//设备编号
                };
                this.popTitle = {
                    'title': '创建工单'
                }
            } else {
                this.params = {
                    "roleName": '',//缩放级别
                    "roleCity": '',//所在城市
                    "roleLat": '',//Lat
                    "roleLng": '',//Lng
                };
                this.addTitle = {
                    "roleName": '角色',
                    "roleCity": '所在城市',
                    "roleLat": '经度',
                    "roleLng": '纬度',
                };
                this.popTitle = {
                    'title': '创建角色'
                }
            }
        },
        // 修改工单
        modify(data) {
            if (this.$route.name == 'role') {
                // {"roleCity":"鞍山","roleId":5,"roleLat":3.0,"roleLng":3.0,"roleName":"测试1"}
                this.params = {
                    "roleCity": data.roleCity,//工单类型
                    "roleId": data.roleId,//工单信息
                    "roleLat": data.roleLat,//设备编号
                    'roleLng': data.roleLng,//工单编号
                    'roleName': data.roleName,//工单编号
                };
                this.addTitle = {
                    "roleCity": '所在城市',//工单类型
                    "roleId": '角色ID',//工单信息
                    "roleLat": '经度',//设备编号
                    'roleLng': '纬度',//工单编号
                    'roleName': '用户名',//工单编号
                };
                this.popTitle = {
                    'title': '修改角色'
                }
            } else {
                this.params = {
                    "alarmType": data.alarmType,//工单类型
                    "workOrderRemark": data.workOrderRemark,//工单信息
                    "equipmentNo": data.equipmentNo,//设备编号
                    'workOrderId': data.workOrderId,//工单编号
                };
                this.addTitle = {
                    "alarmType": '工单类型',//工单类型
                    "workOrderRemark": '工单信息',//工单信息
                    "equipmentNo": '设备编号',//设备编号
                    'workOrderId': '工单编号',//工单编号
                };
                this.popTitle = {
                    'title': '修改工单'
                }
            }
            this.workOrder = true;
        },
        //操作完成对话框关闭
        devHidden(bool) {
            let data = {}
            data = { startTime: this.timer[0], endTime: this.timer[1] }
            getWork(this.url, 'get', data).then(res => {
                this.tableData = res.msg
                this.tota = res.total
            })
            this.workOrder = bool;
        },
        purview(bool) {
            let data = {}
            data = { startTime: this.timer[0], endTime: this.timer[1] }
            getWork(this.url, 'get', data).then(res => {
                this.tableData = res.msg
                this.tota = res.total
            })
            this.purvshow = bool;
        },
        siteEvent(bool) {
            let data = {}
            data = { startTime: this.timer[0], endTime: this.timer[1] }
            getWork(this.url, 'get', data).then(res => {
                this.tableData = res.msg
                this.tota = res.total
            })
            this.siteshow = bool
        },
        // 清空查询
        emptyDev() {
            this.devname = ''
            this.searchContent = ''
            this.typeValue = ''
            let date1 = new Date()
            let y = date1.getFullYear().toString();
            let m = date1.getMonth().toString();
            if (this.$route.name == 'Workorder' || this.$route.name == 'handle') {
                this.timer = [
                    this.formatDate(new Date(y, m, 1).setHours(0, 0, 0)),
                    this.formatDate(new Date().setHours(23, 59, 59))
                ]
            } else {
                this.timer = [
                    this.formatDate(new Date().setHours(0, 0, 0)),
                    this.formatDate(new Date().setHours(23, 59, 59))
                ]
            }
            // this.PageSize = 10
            this.currentPage = 1
            let data = { limit: this.PageSize, offset: this.PageSize * (this.currentPage - 1), search: this.searchContent, startTime: this.timer[0], endTime: this.timer[1] }
            getWork(this.url, 'get', data).then(res => {
                this.tableData = res.msg
                this.tota = res.total
            })
        },
        //查询
        queryDev() {
            this.searchContent = this.devname
            // this.devname; 输入框输入的内容
            if (this.timer == null) {
                this.timer = ''
            }
            this.pageSize = 10
            this.currentPage = 1
            let data = {}
            // console.log(this.popTit.title);
            data = { limit: this.PageSize, offset: this.PageSize * (this.currentPage - 1), search: this.searchContent, startTime: this.timer[0], endTime: this.timer[1], type: this.typeValue }
            if (this.popTit.title == '创建角色') {
                data = { limit: this.PageSize, offset: this.PageSize * (this.currentPage - 1), search: this.searchContent, startTime: this.timer[0], endTime: this.timer[1] }
            }
            if (this.popTit.title == '创建工单') {
                data = { limit: this.PageSize, offset: this.PageSize * (this.currentPage - 1), search: this.searchContent, startTime: this.timer[0], endTime: this.timer[1], state: this.typeValue }
            }
            if (this.searchContent == '' && this.$route.name == 'Reportdata') {
                Message({
                    message: '查询内容不能为空',
                    type: 'warning',
                    duration: 2 * 1000
                })
            } else {
                getWork(this.url, 'get', data).then(res => {
                    // console.log(res);
                    this.tableData = res.msg
                    this.tota = res.total
                })
            }
        },
        // 查询表单条数
        handleSizeChange(val) {
            this.PageSize = val
            let data = { limit: this.PageSize, offset: this.PageSize * (this.currentPage - 1), search: this.searchContent, startTime: this.timer[0], endTime: this.timer[1], state: this.typeValue }
            getWork(this.url, 'get', data).then(res => {
                this.tableData = res.msg
                this.tota = res.total
            })
        },
        // 查询表单页数
        handleCurrentChange(val) {
            this.currentPage = val
            let data = { limit: this.PageSize, offset: this.PageSize * (this.currentPage - 1), search: this.searchContent, startTime: this.timer[0], endTime: this.timer[1], state: this.typeValue }
            getWork(this.url, 'get', data).then(res => {
                // console.log(res);

                this.tableData = res.msg
                this.tota = res.total
            })
        },
        // 全选复选框事件监听
        checkAllChangeFn(val) {
            if (val) {
                // 全选
                this.reset(true);
            } else {
                // 反全选
                this.reset(false);
            }
        },
        // 重置，flag: Boolean，全部重置为flag
        reset(flag) {
            this.columns.forEach(item => {
                item.isShow = flag;
            })
            this.showPopover();
            this.refreshTable();
        },
        // 表格列是否显示的方法
        showColumn(currentColumn) {
            return this.columns.find(item => item.prop == currentColumn).isShow;
        },
        /* 选择列 */
        changeColumns(val) {
            this.columns.forEach(item => {
                item.isShow = false;
            })
            // columns将val数组存在的值设为true，不存在的设为false
            val?.forEach(item => {
                let current = this.columns.find(i => i.label == item)
                current.isShow = true;
            })
            // 判断是否全选
            this.judgeIsCheckAll();
            this.refreshTable();
        },
        // 重新渲染表格
        refreshTable() {
            this.$nextTick(() => {
                this.$refs.table.doLayout();
            })
        },
        // 气泡框出现
        showPopover() {
            this.checkColumns = []
            this.columns.forEach(item => {
                if (item.isShow) {
                    this.checkColumns.push(item.label)
                }
            })
            // 判断是否全选
            this.judgeIsCheckAll();
        },
        // 判断是否全选
        judgeIsCheckAll() {
            // 选中的长度 = 表格列的长度  全选按钮就选中
            if (this.checkColumns.length == this.columns.length)
                this.checkAll = true
            else
                this.checkAll = false
        },

        formatDate(time) {
            const dt = new Date(time);
            const y = dt.getFullYear().toString();
            const mt = dt.getMonth();
            const day = dt.getDate();
            const h = dt.getHours();
            const m = dt.getMinutes();
            const s = dt.getSeconds();
            // 年月日字符串
            return new Date(y, mt, day, h, m, s);
        }
    },
    created() {
        let date = new Date()
        let y = date.getFullYear().toString();
        let m = date.getMonth().toString();
        if (this.$route.name == 'Workorder' || this.$route.name == 'handle') {
            this.timer = [
                this.formatDate(new Date(y, m, 1).setHours(0, 0, 0)),
                this.formatDate(new Date().setHours(23, 59, 59))
            ]
        } else {
            this.timer = [
                this.formatDate(new Date().setHours(0, 0, 0)),
                this.formatDate(new Date().setHours(23, 59, 59))
            ]
        }
        if (this.$route.name !== 'Reportdata') {
            let data = {}
            this.tableData = []
            data = { startTime: this.timer[0], endTime: this.timer[1] }
            getWork(this.url, 'get', data).then(res => {
                // console.log(res);
                this.tableData = res.msg
                this.tota = res.total
            })
        }
    }
}
</script>
   
<style>
.el-image .el-image__error {
    background-color: #ffffff00;
}

.el-image .el-image__preview {
    width: 40px;
}

.popover {
    line-height: 1;
}

.el-table .cell {
    height: 24px;
    white-space: nowrap;
}

.el-table td.el-table__cell div {
    height: 24px;
    white-space: nowrap;
}

/* 复选框 */
.el-checkbox-group {
    display: flex;
    flex-direction: column;
}

/* 操作列图标位置 */
.popover {
    float: right;
    padding-right: 10px;
    border: none;
    font-size: 20px;
}

.el-button--small {
    padding: 3px;
}
</style>